package cn.lingyangwl.agile.pay.model.entity;

import cn.lingyangwl.framework.tool.core.StringUtils;
import cn.lingyangwl.agile.model.BasePO;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * <p>
 * 支付接口配置参数表
 * </p>
 *
 * @author shenguangyang
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("pm_pay_interface_config")
public class PayInterfaceConfig extends BasePO implements Serializable {

    public static LambdaQueryWrapper<PayInterfaceConfig> lqw() {
        return new LambdaQueryWrapper<>();
    }

    private static final long serialVersionUID = 1L;

    /**
     * ID
     */
    @TableId(value = "id")
    private Long id;

    /**
     * 账号类型:1-服务商 2-商户
     */
    private String infoType;

    /**
     * 服务商或商户No
     */
    private String infoId;

    /**
     * 支付接口代码
     */
    private String ifCode;

    /**
     * 接口配置参数,json字符串(会被加密)
     */
    private String ifParams;

    /**
     * 支付接口费率
     */
    private BigDecimal ifRate;

    /**
     * 状态: 0-停用, 1-启用
     */
    private String status;

    /**
     * 备注
     */
    private String remark;

    /**
     * 创建者用户ID
     */
    private Long createdUid;

    /**
     * 创建者姓名
     */
    private String createdBy;

    /**
     * 创建时间
     */
    private Date createdAt;

    /**
     * 更新者用户ID
     */
    private Long updatedUid;

    /**
     * 更新者姓名
     */
    private String updatedBy;

    /**
     * 更新时间
     */
    private Date updatedAt;

    public void setIfParams(String ifParams) {
        if (StringUtils.isEmpty(ifParams)) {
            this.ifParams = "[]";
            return;
        }
        this.ifParams = ifParams;
    }

    public String getIfParams() {
        if (StringUtils.isEmpty(ifParams)) {
            this.ifParams = "[]";
        }
        return ifParams;
    }
}
